﻿//#include "FFTConvolve.h"
//
//
//namespace yzrilyzr_dsp{
//	FFTConvolve::~FFTConvolve(){
//		delete buffer;
//		FFT::deleteComplexArray(input, length);
//		FFT::deleteComplexArray(output, length);
//		FFT::deleteSinCosTable(scTable);
//	}
//	FFTConvolve::FFTConvolve(Complex **convolver, int32_t length): convolver(convolver), length(length){
//		buffer=new RingBuffer(length);
//		scTable=FFT::generateSinCosTable(length);
//		M=FFT::computeM(length);
//		input=FFT::generateComplexArray(length);
//		output=FFT::generateComplexArray(length);
//	}
//	u_sample FFTConvolve::procDsp(u_sample v){
//		buffer->write(v);
//		FFT::inputRingBuffer(input, buffer, length);
//		FFT::fft(input, scTable, M, length);
//		FFT::multiple(input, convolver, output, length);
//		FFT::ifft(output, scTable, M, length);
//		return output[0]->re;
//	}
//	void FFTConvolve::init(u_sample_rate sampleRate){
//	}
//	void FFTConvolve::reset(){
//		buffer->fill(0);
//	}
//	DSP *FFTConvolve::cloneDSP(){
//		return new FFTConvolve(convolver, length);
//	}
//	void FFTConvolve::setConvolve(Complex **convolver){
//		this->convolver=convolver;
//	}
//}
//#ifdef USEJNI
//#include "FFTConvolve_JNI.h"
//using namespace yzrilyzr_dsp;
//JNIEXPORT jlong JNICALL Java_yzrilyzr_dsp_FFTConvolve_constructor(JNIEnv*, jobject, jlong convolver, jint length) {
//	FFTConvolve* ptr = new FFTConvolve(reinterpret_cast<Complex**>(convolver), length);
//	return reinterpret_cast<jlong>(ptr);
//}
//JNIEXPORT void JNICALL Java_yzrilyzr_dsp_FFTConvolve_setConvolve(JNIEnv*, jobject, jlong ptr1, jlong convolver) {
//	FFTConvolve* ptr = reinterpret_cast<FFTConvolve*>(ptr1);
//	ptr->setConvolve(reinterpret_cast<Complex**>(convolver));
//}
//#endif